Skip to content

Conversation

soleblaze
Copy link

@soleblaze soleblaze commented Jun 10, 2023

This fixes the make file so that the object files are created via the build directory instead of in llama.cpp. This fixes the issue where libbinding.a had no knowledge of metal. #91

I also updated the example instructions for metal so that they work properly.

Soleblaze added 2 commits June 9, 2023 20:40
Making these libraries outside of the build directory causes them to
have no knowledge that we're using metal. This prevents metal
acceleration from working. Using the cmake build directory fixes this
issue.
This example failed to load metal due to it missing the SetGPULayers
option.

I also updated the instructions to use go build instead of go run. This
is due to go run not loading the ggml-metal.metal file. I was unable to
get this working. Compiling it and running ./main will load the
ggml-metal.metal file in the CWD.
@soleblaze soleblaze changed the title Fix Metal Support (#91) Fix Metal Support Jun 10, 2023
@mudler
Copy link
Member

mudler commented Jun 10, 2023

Thanks @soleblaze ! nice catch!

@mudler
Copy link
Member

mudler commented Jun 10, 2023

ok weird, CI on mac fails 🤔

For this to compile properly using metal we need to set some CGO_LDFLAGS
so it can find the appropriate frameworks.
@mudler
Copy link
Member

mudler commented Jun 10, 2023

Fantastic, awesome job @soleblaze !


ifeq ($(BUILD_TYPE),metal)
EXTRA_LIBS=
CGO_LDFLAGS+="-framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 feeling guilty, good catch!

@mudler mudler merged commit 53d9b57 into go-skynet:master Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants